#ifndef __Physics_Entity_H
#define __Physics_Entity_H

#include "BaseSubsystems/Math.h"
#include <string>

namespace Logic {
	class CEntity;
}

/**
Physics namespace gathers everything with physics for the architecture.

@author Carlos Fraguas
@date December, 2013
*/
namespace Physics {
	/**
	Basic physics entity. It stores necessary info to deal with physics,
	including collision detection.

	@author Carlos Fraguas
	@date December, 2013
	*/
	class CEntity {
	protected:
		friend class CServer;

		/**
		For now, we're assuming collision detection will be performed
		with circles.
		*/
		float _radius;

		/**
		Physics entity position
		*/
		Vector3 _position;

		/**
		Physics entity name
		*/
		std::string _name;

		/**
		Reference to which logic entity this physics entity belongs to.
		It will be used to notify collisions
		*/
		Logic::CEntity *_logicEntity;

	public:
		/**
		CEntity constructor

		@param float entity's physics radius
		*/
		CEntity(std::string, float radius, Logic::CEntity *logicEntity);

		/**
		CEntity destructor
		*/
		~CEntity();

		/**
		Tests whether the entity collides with another one

		@param CEntity physics entity to check collisions with
		*/
		bool collidesWith(const CEntity *entity) const;

		/**
		Called once per physics frame so entity can update itself
		*/
		void tick(float secs);

		/**
		Sets physics entity position
		*/
		void setPosition(Vector3 position);

		/**
		Gets position
		*/
		Vector3 getPosition() const;
	};
}

#endif